package baiqitun.stupro.project.service.impl;

import baiqitun.stupro.common.service.support.MyServiceImpl;
import baiqitun.stupro.project.core.document.entity.SysProjectDocument;
import baiqitun.stupro.project.core.document.service.SysProjectDocumentService;
import baiqitun.stupro.project.entity.SysProject;
import baiqitun.stupro.project.mapper.SysProjectMapper;
import baiqitun.stupro.project.service.SysProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 项目表 服务实现类
 * </p>
 *
 * @author kedaji
 * @since 2020-04-17
 */
@Service
public class SysProjectServiceImpl extends MyServiceImpl<SysProjectMapper, SysProject> implements SysProjectService {
    @Autowired
    private SysProjectDocumentService sysProjectDocumentService;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void saveWithDocument(SysProject project, SysProjectDocument document) {
        sysProjectDocumentService.save(document);
        project.setDocumentId(document.getId());
        super.save(project);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void removeDocumentById(String documentId) {
        sysProjectDocumentService.removeById(documentId);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void updateProjectType(String projectId, String projectType) {

    }
}
